package normalsys.demo.dao;

import mapper.MsMapper;
import normalsys.demo.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface UserDAO extends MsMapper<User> {

    @Select("<script>"
            + "select * from t_user where 1=1 "
            + "<if test=\"status != 0 \"> and status=#{status} </if> "
            + "<if test=\"status == 0 \"> and status=3 </if> "
            + "order by create_time desc" + "</script>")
    @ResultType(User.class)
    List<User> query(@Param("status") Integer status);

}
